﻿using Domain.Model;
using Domain.Types;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace DTO
{
    public class TaskCategorySimpleOutput
    {
        public virtual int ID { get; set; }
        /// <summary>
        /// 图标
        /// </summary>
        public string Icon { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        public string Title { get; set; }
    }
    public class TaskCategoryOutput: TaskCategorySimpleOutput
    {       
        /// <summary>
        /// 副标题
        /// </summary>
        public string SubTitle { get; set; }
        /// <summary>
        /// 字段数据
        /// </summary>
        public string FieldData { get; set; }
        /// <summary>
        /// 任务步骤
        /// </summary>
        public bool NeedTaskStepData { get; set; }
        /// <summary>
        /// 提交数据
        /// </summary>
        public bool NeedSubField { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }
        /// <summary>
        /// 获取字段数据
        /// </summary>
        /// <returns></returns>
        public List<TaskFieldInfo> GetFieldModels
        {
            get
            {
                if (string.IsNullOrWhiteSpace(FieldData)) return null;

                return JsonConvert.DeserializeObject<List<TaskFieldInfo>>(FieldData);

            }
        }
    }

    public class ModifyTaskDetailsOutput : TaskCategoryOutput
    {
        public override int ID { get; set; }
        public int CategoryID { get; set; }
        public bool IsFinishAll { get; set; }
        public LimitAuditEnum LimitAudit { get; set; }
        public LimitTimeEnum LimitTime { get; set; }
        public string Name { get; set; }
        public int Price { get; set; }
        public TaskStatus Status { get; set; }
        public string StepFieldData { get; set; }
        public string SubFieldName { get; set; }
        public int TotalCount { get; set; }
        public int UserID { get; set; }
        /// <summary>
        /// 任务审核ID
        /// </summary>
        public int TaskAuditID { get; set; }
        public List<TaskStepFieldInfo> GetStepDataField
        {
            get {
                if (string.IsNullOrWhiteSpace(StepFieldData)) return null;

                return JsonConvert.DeserializeObject<List<TaskStepFieldInfo>>(StepFieldData);
            }
        }

        public DateTime? FinishTime { get; set; }
    }
}
